package com.shuzijun.leetcode.editor.cn;
public class LongestIncreasingSubsequence{
    public static void main(String[] args) {
         Solution solution = new LongestIncreasingSubsequence().new Solution();
         solution.lengthOfLIS(new int[]{10,9,2,5,3,7,101,18});
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int lengthOfLIS(int[] nums) {
        int n = nums.length;
        int[] dp = new int[n];
        dp[0] = 1;
        for (int i = 1; i < n; i++) {
            dp[i] = 1;
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]){
                    dp[i] =Math.max(dp[i],dp[j]+1);
                }
            }
        }

        int result = 0;
        for (int i = 0; i < n; i++) {
            if (dp[i] > result) result = dp[i];
        }
        return result;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}